home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 4 / Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso / Science / Asymptote Demo / Examples / Demos / 5) HST Stars / Demo5 next >
Encoding:
Text File  |  1994-05-07  |  1.3 KB  |  55 lines  |  [TEXT/DWat]

  1. % Asymptote Demo #5
  2.  
  3. % This script shows how to read data from rows of a data file
  4. % and plot a histogram
  5. datafile HST STARS
  6. fontname Times
  7. pensize .5
  8.  
  9. % Choose which columns to read
  10. datacolumns 4 20
  11. % Then read them into x and y from rows 1 and 2
  12. readrow x 1
  13. readrow y 2
  14.  
  15. % Close the datafile, we're done with it
  16. close \f
  17.  
  18. graphlimits                                            % Find the graph limits
  19. graphlimits xright xleft ybottom ytop        % Then plot x backwards
  20. graphunits in
  21. graphframe 2 7 2 5
  22. fullscreen yes
  23.  
  24. % Choose the fill pattern to fill under the histogram
  25. fillpat gray
  26. plothistogram 0.0                    % Use 0.0 to for the baseline
  27.  
  28. % Specify our own tick mark spacing in units we like
  29. graphticks .5 1 2e5 1e6
  30. ticksize 9                            % Use 9 point ticks
  31.  
  32. % Make the pen bigger and draw just the frame with no ticks or labels
  33. % This puts a thick border around the graph
  34. pensize 2
  35. drawframe inside inside noticks nolabels nolabels nolabels nolabels
  36.  
  37. pensize 0.25
  38. % Draw the basic frame with ticks and labels
  39. notation general
  40. drawframe
  41.  
  42. scale 1.5
  43. drawtitle  HST Guide Star Catalog
  44. % Use the macro (defined in the macros file) to move to the top right
  45. TR
  46. rpn <y sum >y
  47. digits 1
  48. drawlabel belowleft \y(1) Stars
  49.  
  50. % Make the x and y labels a little smaller than the title
  51. scale 1
  52. drawxlabel Visual Magnitude
  53. drawylabel Number of Stars
  54.  
  55.